﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Bus.Model;
using Bus.Bll;

public partial class admin_admin_left : System.Web.UI.Page
{
    private tb_user admUser = new tb_user();
    private tb_custom cusUser = new tb_custom();
    private UserModel user = null;
    private CustomModel custM = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitLoginInfo();
        }

    }

    private void InitLoginInfo()
    {
        HttpCookie hc = Request.Cookies.Get("bus_ck_info");
        string vl = hc.Value.Trim();
        string[] valuesInfo = vl.Split('&');

        if (valuesInfo[0].Split('=')[1] == "0")
        {
            user = new UserModel();
            user = admUser.GetModel(int.Parse(valuesInfo[1].Split('=')[1]));
            //Session["userid"] = user.uid;
            //Session["utp"] = 0;
            if (user.usertype == 0)
            {
                cstop.Visible = false;
                cscenter.Visible = false;
                csbtm.Visible = false;
            }
            if (user.usertype == 1)
            {
                //utpinfo.Text = "业务员";
                systop.Visible = false;
                syscenter.Visible = false;
                sysbtm.Visible = false;

                //usertop.Visible = false;
                //usercenter.Visible = false;
                //userbtm.Visible = false;

                conttop.Visible = false;
                contbtm.Visible = false;
                contcenter.Visible = false;

                logtop.Visible = false;
                logcenter.Visible = false;
                logbtm.Visible = false;

                cstop.Visible = false;
                cscenter.Visible = false;
                csbtm.Visible = false;

                    
            }
            if (user.usertype == 2)
            {
               //utpinfo.Text = "出纳人员";

                systop.Visible = false;
                syscenter.Visible = false;
                sysbtm.Visible = false;

                usertop.Visible = false;
                usercenter.Visible = false;
                userbtm.Visible = false;

                custop.Visible = false;
                cuscenter.Visible = false;
                custbm.Visible = false;

                //logtop.Visible = false;
                //logcenter.Visible = false;
                //logbtm.Visible = false;

                cstop.Visible = false;
                cscenter.Visible = false;
                csbtm.Visible = false;


            }
           // name.Text = user.username.Trim();
        }
        else
        {
            custM = new CustomModel();
            custM = cusUser.GetModel(int.Parse(valuesInfo[1].Split('=')[1]));
            //Session["userid"] = custM.cid;
            //Session["utp"] = 1;
           // name.Text = custM.cname.Trim();
           // utpinfo.Text = "乘客";
            systop.Visible = false;
            syscenter.Visible = false;
            sysbtm.Visible = false;

            usertop.Visible = false;
            usercenter.Visible = false;
            userbtm.Visible = false;



            logtop.Visible = false;
            logcenter.Visible = false;
            logbtm.Visible = false;

            conttop.Visible = false;
            contbtm.Visible = false;
            contcenter.Visible = false;

            custop.Visible = false;
            cuscenter.Visible = false;
            custbm.Visible = false;
           
        }


    }

}
